Countdown Timer Using Arduino

The circuit here Countdown timer using Arduino is a simple circuit with the facility of the timer, this circuit is designed for 50 minutes timer but you can change it according to your requirement. Electronic circuits are usually designed for a specific purpose, which means one circuit performs only one task, in general cases. When this circuit is used, the time at which it is selected can be stored electronically while being displayed simultaneously. Talking about the circuit components, it uses an Arduino board, 7-segment display, PNP transistor, and a few other electronic components which are commonly available.

Project Description of Countdown Timer Using Arduino

As the project countdown timer uses Arduino, it can be divided into two main parts

  • The Hardware | Countdown Timer Using Arduino

Figure 3 shows the circuit of the countdown timer using Arduino. This section includes all the hardware required. The circuit makes use of four 7-segment displays and is designed to display the time. Transistors T1 through T4 are used as a switch and always turn fully on or off. In addition, passive components like a few resistors, and switches are employed. A rotary encoder as shown in figure 2 is an electro-mechanical device that converts the angular position to an analog or digital code.

circuit diagram of countdown timer using arduino

Pin of all 7-segment displays except common anode pin is connected in parallel. Eight digital pins of Arduino (D12, D11, D10, D9, D8, D7, D6, and D5) are connected to 8 pins of seven segment display (pin a, b, c, d, e, f, g, and DP) respectively. Four PNP transistor (BC307) is used to switch the display ON and OFF. +5V for Arduino UNO board is given to the emitter pin of all four transistors where the base of these transistors is connected to Arduino analog pin A0 to A3 through a current limiting resistor as shown in the circuit diagram. One piezo buzzer is connected to analog pin A4 as shown in the circuit diagram to produce audio sound. One Rotary encoder is used to select the timer and to toggle between stop and running mode. Rotary encoders have altogether 5 pin categories as output pin, button pin, and common pin. two output pin (OUT1 and OUT2) is connected to Arduino digital pin D2 and D3 respectively whereas the button pin is connected to pin D2 of Arduino. The rest of the two-pin (common pin) is connected to +5V of Arduino.

author prototype of countdown timer using arduino

Figure 1: Author prototype of Countdown timer using Arduino

Rotary encoder

PARTS LIST OF COUNTDOWN TIMER USING ARDUINO

Resistor (all ¼-watt, ± 5% Carbon)
R1 – R4 = 1 KΩ 0.5W

R5 – R7 = 100 KΩ, 0.5W

R8 – R15 = 100 Ω, 0.5W

Semiconductors
Arduino Board

T1 – T4 = BC307

Dis1 – Dis4 = Common Anode 7-Segment Display

Miscellaneous
Rotary Encoder

PZ1 = Piezo Buzzer

The Software | Countdown Timer Using Arduino

The code is so designed that all four displays are lit at the same time. There are two states in this countdown timer. In the running stage, it will countdown the timer and in the stopped state, the time will be changed by turning the rotary encoder were pressing the button on the rotary encoder will toggle between two-state. Here, we made an array of some standard times which can be changed by rotating the encoder instead of 1 second. We used the EEPROM library to store the last used time, and it always powered with the last used time

The Code | Countdown Timer Using Arduino

NOTE: This project was created on Nov 4, 2015, and updated with little modification in code and circuit.

8 Thoughts to “Countdown Timer Using Arduino”

  1. Martin

    hi,

    I have found your site very helpful thanks for the circuit diagram was searching for one with cathode anode. I am struggling to get the code that goes with the project to compile and then upload. keep getting syntax errors. please can you help shed some light on what I am doing wrong?? thanks

  2. siva prakash

    hi this is siva prakash, i had compiled your code to my arduino board but there is an error like Arduino: 1.7.10 (Windows 8.1), Board: “Arduino Uno”

    Build options changed, rebuilding all

    _7_seg_time_controller.ino:229:5: error: stray ” in program

    _7_seg_time_controller.ino:229:5: error: stray ” in program

    _7_seg_time_controller.ino:229:5: error: stray ” in program

    _7_seg_time_controller.ino:237:5: error: stray ” in program

    _7_seg_time_controller.ino:237:5: error: stray ” in program

    _7_seg_time_controller.ino:237:5: error: stray ” in program

    _7_seg_time_controller.ino:301:5: error: stray ” in program

    _7_seg_time_controller.ino: In function ‘void updateCountingTime()’:

    _7_seg_time_controller.ino:229:18: error: expected ‘;’ before ‘u00e2’

    _7_seg_time_controller.ino:237:18: error: expected ‘;’ before ‘u00e2’

    _7_seg_time_controller.ino: In function ‘int getEncoderTurn()’:

    _7_seg_time_controller.ino:301:26: error: expected ‘)’ before ‘u2013’

    Error compiling.

    This report would have more information with
    “Show verbose output during compilation”
    enabled in File > Preferences.

    pls tell me what is the changes i have to do in this program …..

    1. Siva Prakash
      Where’d you get Arduino 1.7.10?
      The Arduino.cc IDE is only at 1.6.12:
      https://www.arduino.cc/en/Main/Software

      1. siva prakash

        sorry sir i didn’t compiled , i just verified your program code in my ide software , so that it showed error

        1. The code given above is correct and is verified. If you have got any error then i had also updated download link above code you can directly download and use that code instead.

          1. siva prakash

            Thank you for reply sir , pls send me that link sir

  3. Neil Hennessy

    Hi, I’m really new at Arduino, and perhaps this is beyond me, but I was wondering what board you used. I have a UNO and can’t get the board pin numbers to make sense. Pretty sure I’m missing something simple!!
    Thanks, Neil.

  4. Ryan Quah

    I have done basically the same but I did not use pnp transistor. I am direct connection from UNO to 4 digits seven segment. The 4 digit is turn on by common cathode. Not common annode. The issues is i get unrecognised character display when the encoder button is pressed and turn. I change the digitalWrite(displayPins[i], (digit != i)); to
    digitalWrite(displayPins[i], (digit == i)); still it does not display proper characters. When the encoder is not turn, it show –:–
    My Seven seven connection is correct as I use other programs to display everything correctly. The setup is also correctly modified.
    Can you advice what is the issue ?

Leave a Comment